<div id="content-title">Register Teachers</div>

<script type="text/javascript">
$(document).ready(function() {
	// validate signup form on keyup and submit
	var validator = $("#addTeacher-form").validate({
		rules: {
		teacherName: "required",
		
		teacherNIC: {
			required: true,
			minlength: 10,
			maxlength: 10
		},
		teacherPass: {
			required: true,
			minlength: 6
		},
		teacherConfirmPass: {
			required: true,
			minlength: 6,
			equalTo: "#teacherPass"
		}
	},
	messages: {
		teacherName: "Please enter Teacher's Name",
		
		teacherNIC: {
			required: "Enter a valid NIC no",
			minlength: "Invalid NIC no",
			maxlength: "Invalid NIC no"
		},
		teacherPass: {
			required: "Please provide a password",
			minlength: "Password should be at least 6 characters long"
		},
		teacherConfirmPass: {
			required: "Please enter the same password",
			minlength: "Please enter the same password",
			equalTo: "Please enter the same password"
		}
	},
	// the errorPlacement has to take the table layout into account
	errorPlacement: function(error, element) {
		if ( element.is(":radio") )
			error.appendTo( element.parent().next().next() );
		else if ( element.is(":checkbox") )
			error.appendTo ( element.next() );
		else
			error.appendTo( element.parent().next() );
	},
});
// check if confirm password is still valid after password changed
$("#teacherPass").blur(function() {
	$("#teacherConfirmPass").valid();
});

});
</script>

<div id="content-data">
<div class="web-form">
<form name="addTeacher-form" id="addTeacher-form" method="post"
	action="./system/addTeacher.php">
<fieldset><legend class="left">Add Teacher</legend>
<table>
	<tbody>
		<tr>
			<td colspan="3"><?php if($_SESSION['log-err'])echo "<div class='log-err'>".$_SESSION['log-err']."</div>"; ?>
			<?php if($_SESSION['log-info'])echo "<div class='log-info'>".$_SESSION['log-info']."</div>"; ?>
			</td>
		</tr>
		<tr>
			<td class="left"><label class="web-form-label">Full Name :</label></td>
			<td class="right"><input type="text" name="teacherName"
				class="web-form-field" id="teacherName" /></td>
			<td class="left">
			<div id="teacherName-log" class="log-err"></div>
			</td>
		</tr>
		<tr>
			<td class="left"><label class="web-form-label">NIC no :</label></td>
			<td class="right"><input type="text" name="teacherNIC"
				id="teacherNIC" class="web-form-field" /></td>
			<td class="left">
			<div id="teacherNIC-log" class="log-err"></div>
			</td>
		</tr>
		<tr>
			<td class="left"><label class="web-form-label">Password :</label></td>
			<td class="right"><input type="password" name="teacherPass"
				id="teacherPass" class="web-form-field" /></td>
			<td class="left">
			<div id="teacherPass-log" class="log-err"></div>
			</td>
		</tr>
		<tr>
			<td class="left"><label class="web-form-label">Confirm Password :</label></td>
			<td class="right"><input type="password" name="teacherConfirmPass"
				id="teacherConfirmPass" class="web-form-field" /></td>
			<td class="left">
			<div id="teacherConfirmPass-log" class="log-err"></div>
			</td>
		</tr>
		<tr>
			<td class="left"></td>
			<td class="right">
			<button type="submit" class="web-form-button"><img
				src="./public/images/add_user.png"><span>Add Teacher</span></button>
			</td>
			<td></td>
		</tr>
	</tbody>
</table>
</fieldset>
</form>
</div>
</div>
